﻿using FI.Architecture.Server;
using FI.Core.IoC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FI.Security
{
    public class SitemapBC : BusinessComponentBase
    {

        public IEnumerable<SitemapModel> GetSitemaps()
        {
            using (var da = ServiceLocator.GetService<SiteMapStore>())
            {
                return da.GetSitemaps();
            }
        }

        public void AddSitemap(SitemapModel sitemapModel)
        {
            using (var da = ServiceLocator.GetService<SiteMapStore>())
            {
                da.AddSitemap(sitemapModel);

            }

        }


        public void UpdateSitemap(SitemapModel sitemapModel)
        {
            using (var da = ServiceLocator.GetService<SiteMapStore>())
            {
                da.UpdateSitemap(sitemapModel);

            }
        }

        public void UpdateSitemaps(List<SitemapModel> sitemapModels)
        {
            using (var da = ServiceLocator.GetService<SiteMapStore>())
            {
                foreach (var sitemap in sitemapModels)
                {
                    da.UpdateSitemap(sitemap);
                }

            }
        }
    }

}

